package zhoug.demo.zui.ui;

import android.graphics.Color;
import android.os.Bundle;
import android.widget.Button;

import java.util.Arrays;

import androidx.appcompat.app.AppCompatActivity;
import zhoug.demo.zui.R;
import zhoug.zui.chart.marker.ZUIPieMarker;
import zhoug.zui.chart.pie.PieEntry;
import zhoug.zui.chart.pie.ZUIPieChartView;

public class ZUIPieChartActivity extends AppCompatActivity {
    private static final String TAG = ">>>ZUIPieChartActivity";
    private static final boolean DEBUG=false;

    private ZUIPieChartView mPieChartView;
    private Button mBtnStartAnim;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zui_pie_chart);
        findViews();
        ZUIPieMarker pieMarker=new ZUIPieMarker(this,mPieChartView);
        pieMarker.setIntegerValue(true);
        mPieChartView.setMarker(pieMarker);
        mPieChartView.setEntries(Arrays.asList(
                new PieEntry(3000,"经营许可证"),
                new PieEntry(2000,"营业执照"),
                new PieEntry(4500,"许可证"),
                new PieEntry(250,"其它1"),
                new PieEntry(250,"其它2"),
                new PieEntry(250,"其它3"),
                new PieEntry(250,"其它4"),
                new PieEntry(250,"其它5"),
                new PieEntry(250,"其它6"),
                new PieEntry(250,"其它7"),
                new PieEntry(250,"其它8")

        ));
        mPieChartView.setColors(new int[]{Color.RED,Color.BLUE,Color.GREEN,Color.YELLOW});
        mPieChartView.startAnim(500);
        mBtnStartAnim.setOnClickListener(v->{
            mPieChartView.startAnim(500);
        });


    }


    private void findViews() {
        mPieChartView = findViewById(R.id.pieChartView);
        mBtnStartAnim = findViewById(R.id.btn_startAnim);

    }
}